<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>

<body>

  <button id="box">click 0</button>

  <script>
    let i = 1;
    let box = document.getElementById('box');
    box.onclick = function () {
      // console.log(i++);
      // 模版字符串
      box.innerText = `click ${i++}`
      if (i > 4) {
        box.innerText = 'close'
        // js 函数this指向问题
        this.onclick = function () { }
      }
    }
  </script>
</body>

</html>